package com.poppy.poi;

import java.util.List;
import java.util.UUID;

import org.nutz.dao.Dao;

import com.poppy.nutz.glodon.bean.Material;
import com.poppy.poi.reader.IRowReader;

public class RowReader implements IRowReader {
	
	private Dao dao = null;
	
	public RowReader(Dao dao) {
		super();
		this.dao = dao;
	}

	/*
	 * 业务逻辑实现方法
	 * 
	 * @see com.eprosun.util.excel.IRowReader#getRows(int, int, java.util.List)
	 */
	public void getRows(int sheetIndex, int curRow, List<String> rowlist) {
		
		Material m = new Material();
		m.setMaterialcode(rowlist.get(0));
		m.setMaterialname(rowlist.get(1));
		m.setSpecification(rowlist.get(2));
		m.setMaterialid(UUID.randomUUID().toString().replaceAll("-", ""));
		dao.fastInsert(m);
//		System.out.print(curRow + " ");
//		for (int i = 0; i < rowlist.size(); i++) {
//			System.out.print(rowlist.get(i) + " ");
//		}
//		System.out.println();
	}

}